package com.example.spring.aop.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * @author luowj12
 * @since 2021/6/7 9:28
 */
@Service
@Slf4j
public class NeedLogService {

    private Random random = new Random(System.currentTimeMillis());

    public int logMethod(String someParam) {
        log.info("---NeedLogService: logMethod invoked, param: {}---", someParam);
        return random.nextInt();
    }

    public void exceptionMethod() throws Exception {
        log.info("---NeedLogService: exceptionMethod invoked---");
        throw new Exception("Something bad happened!");
    }

}
